﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Gestion.Ui;


    public partial class Editor_StringMultilineEditor : BaseUserControl, IPropertyEditor
    {
        #region Properties

        public String Label
        {
            set
            {
                EditorLabel.Text = value;
            }
            get
            {
                return EditorLabel.Text;
            }
        }

        public String Value
        {
            set
            {
                if (value != null)
                {
                    EditorTextBox.Text = value;
                }
            }
            get
            {
                if (EditorTextBox.Text == null)
                {
                    return null;
                }
                else
                {
                    if (EditorTextBox.Text.Trim().Length > 0)
                    {
                        return EditorTextBox.Text;
                    }
                    else
                    {
                        return null;
                    }
                }
            }
        }

        private Boolean _isRequired = false;
        public Boolean IsRequired
        {
            set
            {
                _isRequired = value;
            }
            get
            {
                return _isRequired;
            }
        }

        public String ErrorMsgRequiredValidator
        {
            set
            {
                EditorRequiredFieldValidator.ErrorMessage = value;
            }
            get
            {
                return EditorRequiredFieldValidator.ErrorMessage;
            }
        }

        public Boolean Enabled
        {
            set
            {
                EditorTextBox.Enabled = value;
            }
            get
            {
                return EditorTextBox.Enabled;
            }
        }

        public System.Web.UI.WebControls.Unit Height
        {
            set
            {
                EditorTextBox.Height = value;
            }
            get
            {
                return EditorTextBox.Height;
            }
        }

        public System.Web.UI.WebControls.Unit Width
        {
            set
            {
                EditorTextBox.Width = value;
            }
            get
            {
                return EditorTextBox.Width;
            }
        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                EditorRequiredFieldValidator.Enabled = IsRequired;
        }
    }
